<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
User: 24390 Date: 2021/1/9 Time: 22:22
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" isErrorPage="true" %>
<html>
<head>
    <title>员工列表</title>
    <link rel="stylesheet" href="../static/css/bootstrap.css">
    <script src="../static/js/jquery-1.9.1.min.js"></script>
    <script src="../static/js/bootstrap.js"></script>
</head>
<body>
    <div class="container">
<%--    标题--%>
        <div class="row">
            <div class="col-md-12">
                <h1>SSM-CRUD</h1>
            </div>
        </div>

<%--    按钮--%>
        <div class="row">
<%--            共12列，占四列，向右偏移四列 *4* 4 *4*--%>
            <div class="col-md-4 col-md-offset-8">
                <button class="btn btn-success">添加员工</button>
                <button class="btn btn-success">删除全部</button>
            </div>
        </div>
<%--    表格数据--%>
        <div class="row">
            <div class="col-md-12">
                <table class="table table-hover">
                    <tr>
                        <th>empId</th>
                        <th>empName</th>
                        <th>gender</th>
                        <th>email</th>
                        <th>deptName</th>
                        <th>操作</th>
                    </tr>
                    <c:forEach items="${pageInfo.list}" var="emp">
                        <tr>
                            <th>${emp.empId}</th>
                            <th>${emp.empName}</th>
                            <th>${emp.gender=="1"?"男":"女"}</th>
                            <th>${emp.email}</th>
                            <th>${emp.department.deptName}</th>
                            <th>
                                <button class="btn btn-warning btn-sm">
                                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    修改
                                </button>
                                <button class="btn btn-danger btn-sm">
                                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                                    删除
                                </button>
                            </th>
                        </tr>
                    </c:forEach>

                </table>
            </div>
        </div>
<%--    分页信息--%>
        <div class="row">
<%--            分页条信息--%>
            <div class="col-md-6 col-md-offset-2">
                <nav aria-label="Page navigation">
                    <ul class="pagination">
                        <li><a href="/emps?pageNo=1">首页</a></li>
                        <c:if test="${pageInfo.hasNextPage}">
                            <li>
                                <a href="/emps/pageNo=${pageInfo.pageNum-1}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <c:forEach items="${pageInfo.navigatepageNums}" var="pageNo">
                            <c:if test="${pageNo == pageInfo.pageNum}">
                                <li class="active"><a href="#">${pageNo}</a></li>
                            </c:if>
                            <c:if test="${pageNo != pageInfo.pageNum}">
                                <li><a href="/emps?pageNo=${pageNo}">${pageNo}</a></li>
                            </c:if>
                        </c:forEach>
                        <c:if test="${pageInfo.hasNextPage}">
                            <li>
                                <a href="/emps?pageNo=${pageInfo.pageNum+1}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:if>
                        <li><a href="/emps?pageNo=${pageInfo.pages}">末页</a></li>
                    </ul>
                </nav>
            </div>
<%--            分页文字信息--%>
            <div class="col-md-4">
                当前${pageInfo.pageNum}页,
                总${pageInfo.pages}页,
                共${pageInfo.total}条记录
            </div>
        </div>
    </div>
</body>
</html>
